import 'dart:async';

import 'package:flutter/services.dart';

class FlutterAlbumSave {
  static const MethodChannel _channel =
  const MethodChannel('flutter_album_save');

  /*
  保存图片到相册
  @params imagePath 图片绝对路径
  @params albumName 分组名
   */
  static Future<_Result> saveImageToAlbum(String imagePath,
      String albumName) async {
    var _result = await _channel.invokeMethod(
        'saveImageToAlbum', {"imagePath": imagePath, "albumName": albumName});

    var result = _Result(
        _result['status'] ?? false, _result['msg']
    );
    return result;
  }
}

class _Result {
  bool status;
  String msg;

  _Result(this.status, this.msg);

  Map toMap() {
    return {
      "status": status,
      "msg": msg};
  }
}
